SafeDestroy

Category: Objects

Syntax:
SafeDestroy object

Waits for all event handlers to finish running, then destroys the object. Use this instead of Destroy when you need to destroy an object from one of its event handlers, or an event handler belonging to one of its child controls.

Example:
@ $form = $new(TForm position 10,10,100,100)
@ $btn = $new(TButton ownedby $form position 5,5,80,20)
@p $btn.Caption = Kill the form
@e $btn.OnClick = SafeDestroy $form

See also: Destroy, New


Next in "Objects": UnmapObject
Previous in "Objects": RemoveFromSetProp
Next by name: SameNick
Previous by name: RStrTokREx
Up to all commands by name or commands and functions by category